<!DOCTYPE html>
<html lang="en">


{include file="Public/head"}

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">订单列表</div>
                        </div>
                        <div class="widget-body  am-fr">


                            <!--筛选搜索-->
                            <form action=""></form>

                            <form id="searchform" action="{:Url('index')}"  method="get" class="am-form tpl-form-border-form tpl-form-border-br">
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="text" class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"  name="consignee" placeholder="收货人">
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="text" class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"  name="order_sn" placeholder="订单编号">
                                    </div>
                                </div>

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm'}" name="pay_status">
                                            <option value="-1">支付状态</option>
                                            <option value="0" >未支付</option>
                                            <option value="1">已支付</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm'}" name="pay_code">
                                            <option value="-1">支付方式</option>
                                            <option value="alipay">支付宝支付</option>
                                            <option value="weixin">微信支付</option>
                                            <option value="cod">货到付款</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm'}" name="shipping_status">
                                            <option value="-1">发货状态</option>
                                            <option value="0">未发货</option>
                                            <option value="1">已发货</option>
                                            <option value="2">部分发货</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm'}" name="order_status">
                                            <option value="-1">订单状态</option>
                                            <option value="0">待确认</option>
                                            <option value="1">已确认</option>
                                            <option value="2">已收货</option>
                                            <option value="3">已取消</option>
                                            <option value="4">已完成</option>
                                            <option value="5">已作废</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-2" style="float: left;">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="text" class="form-control pull-right"  name="add_time" id="start_time" placeholder="下单时间">
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-1" style="float: left;">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <span class="am-input-group-btn">
                                            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="submit" ></button>
                                        </span>
                                    </div>
                                </div>

                            </form>
                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                    <thead>
                                    <tr>

                                        <th>订单编号</th>
                                        <th>收货人</th>
                                        <th>总金额</th>
                                        <th>应付金额</th>
                                        <th>订单状态</th>
                                        <th>支付状态</th>
                                        <th>发货状态</th>
                                        <th>下单时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {foreach name="data" key="key" item="value"}
                                    <tr class="gradeX">
                                        <td>{$value.order_sn}</td>
                                        <td>{$value.consignee}：{$value.mobile}</td>
                                        <td>{$value.goods_price}</td>
                                        <td>{$value.order_amount}</td>
                                        <td>{$order_status[$value.order_status]}</td>
                                        <td>{if $value.pay_status==0}未支付{elseif $value.pay_status==1}已支付{/if}</td> <!--支付状态-->
                                        <td>{if $value.shipping_status==0}
                                            <span style="color: #F37B1D">未发货</span>
                                            {else}
                                            已发货
                                            {/if}
                                        </td> <!--发货状态-->

                                        <!--<td>{$value.pay_name}</td> &lt;!&ndash;支付方式&ndash;&gt;-->
                                        <!--<td>{$value.shipping_name}</td> &lt;!&ndash;配送方式&ndash;&gt;-->
                                        <td>{$value.add_time|date='Y-m-d H:i:s',###}</td>
                                        <td>
                                            <div class="tpl-table-black-operation">
                                                <a href="{:Url('particular')}?order_id={$value.order_id}">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                                {if $value.order_status==3||$value.order_status==5}
                                                <a   class="tpl-table-black-operation-del" onclick="del_button({$value.order_id});">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                                {else /}
                                                <a  style="color: #adabab; border: 1px solid #adabab;" disabled="disabled"  class="tpl-table-black-operation-del">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                                {/if}

                                            </div>
                                        </td>
                                    </tr>
                                    {/foreach}
                                    <!-- more data -->
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-lg-10 am-cf">

                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination">
                                        {$data->render()}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
{include file='Public:script'}
<link href="/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css">
<script src="/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="/daterangepicker/daterangepicker.js" type="text/javascript"></script>

<script>
    // 删除按钮
    function del_button(id, className) {
        layer.confirm("确定删除？", {btn: ["确定","取消"], shade: 0.5}, function(){
            // 删除权限组
            $.post("{:url('del')}", {id: id}, function(res) {
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 2});
                    return false;
                }

                layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 1}, function() {
                    layer.closeAll('page');
                    location.reload();
                });
            });
        }, function () {});
    }

    //提交
    function roleSubmit() {
        var form = document.getElementById("searchform");
        var formData = new FormData(form);
        $.ajax({
            url: "{:Url('index')}",
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success: function (res) {
                console.log(res);
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 1}, function () {
                    window.location.href = document.referrer;

                });
            }
        })
    }

    //选择时间js
    $(document).ready(function() {
        $('#start_time').daterangepicker({
            format:"YYYY-MM-DD",
            singleDatePicker: false,
            showDropdowns: true,
            minDate:'2016-01-01',
            maxDate:'2030-01-01',
            startDate:'2016-01-01',
            showWeekNumbers: true,
            timePicker: false,
            timePickerIncrement: 1,
            timePicker12Hour: true,
            ranges: {
                '今天': [moment(), moment()],
                '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
                '最近7天': [moment().subtract('days', 6), moment()],
                '最近30天': [moment().subtract('days', 29), moment()],
                '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
            },
            opens: 'right',
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary',
            cancelClass: 'btn-small',
            locale : {
                applyLabel : '确定',
                cancelLabel : '取消',
                fromLabel : '起始时间',
                toLabel : '结束时间',
                customRangeLabel : '自定义',
                daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
                monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
                firstDay : 1
            }
        });
    });
</script>
</html>